#include <REGX52.H>
#include "Timer0.h"

sbit Motor=P1^0;
sbit LED=P2^0;

unsigned char Counter,Compare;	//???????,????PWM


void Motor_Init()
{
	Timer0_Init();
}

void Motor_SetSpeed(unsigned char speed)
{
	Compare=speed;
}

void Timer0_Routine() interrupt 1
{
	TL0 = 0xA4;		//???????
	TH0 = 0xFF;		//???????
	Counter++;
	Counter%=100;	//??????????0~99
	if(Counter<Compare)	//????????
	{
		Motor=1;		//??1
		LED=0;
	}
	else				//????????
	{
		Motor=0;		//??0
		LED=1;
	}
}
